import '../public.dart';

class ClientWithdrawApi {
  /// 提现
  /// /clientWithdraw/withdraw
  static Future<BaseResponse<void>> withdraw(ClientWithdrawDto params) async {
    final response = await HttpUtil().request(
      '/clientWithdraw/withdraw',
      method: 'POST',
      data: params.toJson(),
    );
    return BaseResponse<void>.fromJson(response);
  }

  /// 分页查询提现记录
  /// /clientWithdraw/getRecordPage
  static Future<BaseResponse<PagedDataResponse<WithdrawRecordPageResponseDto>>>
  getRecordPage(WithdrawRecordPageRequestDto params) async {
    final response = await HttpUtil().request(
      '/clientWithdraw/getRecordPage',
      method: 'POST',
      data: params.toJson(),
    );
    return BaseResponse<
      PagedDataResponse<WithdrawRecordPageResponseDto>
    >.fromJson(
      response,
      fromJsonT: (json) =>
          PagedDataResponse<WithdrawRecordPageResponseDto>.fromJson(
            json,
            (json2) => WithdrawRecordPageResponseDto.fromJson(json2),
          ),
    );
  }
}
